package cn.agiledata.bank.common.service;

import java.util.Map;

import cn.agiledata.bank.common.dao.ActionTypeTemplate;
import cn.agiledata.bank.common.util.DateUtil;
import cn.agiledata.bank.common.util.WeatherUtil;
import cn.agiledata.bank.hibernateBean.ScoresHis;
import cn.agiledata.bank.hibernateBean.SubAccount;
import cn.agiledata.bank.hibernateBean.Transaction;
import com.vnv.infrastructure.logic.IPBAppFactory;

/**
 * 发货提醒邮件格式
 * 
 * @author 马贤波 
 * 2007-1-31
 */
public class ProductSendNotifyMail extends NotifyMail {
	/**
	 * 发货提醒邮件格式
	 */
	

	protected SubAccount setMailContext(Map vnvMap, Transaction tran, ScoresHis score) {
		SubAccount emailTo = tran.getCredit(),
		   anotherOne = tran.getDebit();
		  ActionTypeTemplate at = (ActionTypeTemplate) IPBAppFactory.getObj("actionTypeTemplate");
/** 交易对方：付款方 */
vnvMap.put("account", WeatherUtil.getNameOrEmailOrMobileByAccount(anotherOne.getAccount()));
/** 交易号 */
vnvMap.put("tranId", tran.getTransId());
/** 交易发生时间 */
vnvMap.put("tranTime", DateUtil.date2String(tran.getBeginDate()));
/** 交易截止时间 */
vnvMap.put("tranEnd", DateUtil
		.date2String(NotifyUtil.getPermitedEndDate(
				tran.getUpdateTime(), tran.getTransStatus())));
String status = at.getTransStatusById(tran.getTransStatus()).getListName();
/** 交易状态* */
vnvMap.put("status", status);
vnvMap.put("fee", tran.getCreditFee().toString());
double amount = tran.getAmount().doubleValue() - tran.getCreditFee().doubleValue();
vnvMap.put("amount", amount+"");
/** 交易金额* */
vnvMap.put("trueFee", tran.getAmount());
String titlemessage = " 您有一个交易即将超过发货时限，请立即完成发货，逾期本交易将自动关闭。";
vnvMap.put("titlemessage", titlemessage);
return emailTo;
	}

}
